/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.ejb.controleProjeto.entidade;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "artefato", catalog = "macielqs", schema = "controleprojeto")
@NamedQueries({
    @NamedQuery(name = "Artefato.findAll", query = "SELECT a FROM Artefato a"),
    @NamedQuery(name = "Artefato.findById", query = "SELECT a FROM Artefato a WHERE a.id = :id"),
    @NamedQuery(name = "Artefato.findByNome", query = "SELECT a FROM Artefato a WHERE a.nome = :nome"),
    @NamedQuery(name = "Artefato.findByObservacao", query = "SELECT a FROM Artefato a WHERE a.observacao = :observacao"),
    @NamedQuery(name = "Artefato.findByComplexidade", query = "SELECT a FROM Artefato a WHERE a.complexidade = :complexidade"),
    @NamedQuery(name = "Artefato.findByUrl", query = "SELECT a FROM Artefato a WHERE a.url = :url")})
public class Artefato implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nome", nullable = false, length = 85)
    private String nome;
    @Basic(optional = false)
    @Column(name = "observacao", nullable = false, length = 2147483647)
    private String observacao;
    @Basic(optional = false)
    @Column(name = "complexidade", nullable = false, length = 25)
    private String complexidade;
    @Basic(optional = false)
    @Column(name = "url", nullable = false, length = 85)
    private String url;
    @JoinTable(name = "tarefa_has_artefato", joinColumns = {
        @JoinColumn(name = "artefato_id", referencedColumnName = "id", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "tarefa_id", referencedColumnName = "id", nullable = false)})
    @ManyToMany
    private List<Tarefa> tarefaList;
    @JoinTable(name = "artefato_has_item_artefato", joinColumns = {
        @JoinColumn(name = "artefato_id", referencedColumnName = "id", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "item_artefato_id", referencedColumnName = "id", nullable = false)})
    @ManyToMany
    private List<ItemArtefato> itemArtefatoList;
    @JoinTable(name = "tarefa_gera_artefato", joinColumns = {
        @JoinColumn(name = "artefato_id", referencedColumnName = "id", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "tarefa_id", referencedColumnName = "id", nullable = false)})
    @ManyToMany
    private List<Tarefa> tarefaList1;
    @JoinColumn(name = "tipo_artefato_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private TipoArtefato tipoArtefato;
    @JoinColumn(name = "release_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Release release;

    public Artefato() {
    }

    public Artefato(Integer id) {
        this.id = id;
    }

    public Artefato(Integer id, String nome, String observacao, String complexidade, String url) {
        this.id = id;
        this.nome = nome;
        this.observacao = observacao;
        this.complexidade = complexidade;
        this.url = url;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getObservacao() {
        return observacao;
    }

    public void setObservacao(String observacao) {
        this.observacao = observacao;
    }

    public String getComplexidade() {
        return complexidade;
    }

    public void setComplexidade(String complexidade) {
        this.complexidade = complexidade;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public List<Tarefa> getTarefaList() {
        return tarefaList;
    }

    public void setTarefaList(List<Tarefa> tarefaList) {
        this.tarefaList = tarefaList;
    }

    public List<ItemArtefato> getItemArtefatoList() {
        return itemArtefatoList;
    }

    public void setItemArtefatoList(List<ItemArtefato> itemArtefatoList) {
        this.itemArtefatoList = itemArtefatoList;
    }

    public List<Tarefa> getTarefaList1() {
        return tarefaList1;
    }

    public void setTarefaList1(List<Tarefa> tarefaList1) {
        this.tarefaList1 = tarefaList1;
    }

    public TipoArtefato getTipoArtefato() {
        return tipoArtefato;
    }

    public void setTipoArtefato(TipoArtefato tipoArtefato) {
        this.tipoArtefato = tipoArtefato;
    }

    public Release getRelease() {
        return release;
    }

    public void setRelease(Release release) {
        this.release = release;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Artefato)) {
            return false;
        }
        Artefato other = (Artefato) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.controleProjeto.entidade.Artefato[id=" + id + "]";
    }

}
